package com.tree.redisson.controller;

import com.tree.redisson.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName com.tree.redisson
 * Description: <类功能描述>.
 * <br>
 * @Author frankzsliu
 * @Date 2020/11/8 1:59 下午
 * @Version 1.0
 */
@RequestMapping("/order")
@RestController
public class OrderController {
    @Autowired
    OrderService orderService;

    @ResponseBody
    @GetMapping("decrease")
    public String decreaseOrder() throws InterruptedException {
            return orderService.decreasePrice( 1);
    }

    @ResponseBody
    @GetMapping("init")
    public void init(Integer num) {
        orderService.init(num);
    }
}
